<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include("layouts.common.head")
<!-- Fonts -->
    <link href="{{ asset('static/css/company/common.css') }}" rel="stylesheet">
    <link href="{{ asset('static/css/company/company_user.css') }}" rel="stylesheet">
    <!-- Styles -->
    <style>
        html {
            overflow-y: scroll;
        }
    </style>
</head>
<body>
<div id="app">
    @include("layouts.nav")
    @include("company.info.other_top_nav")
    <div class="user_main">
        <div class="mleft">
            @include('company.info.left')
        </div>
        <div class="mright">
            <div class="user_pagetitle">
                <div class="pat_l">基本资料</div>
                <div class="clear"></div>
            </div>
            <div class="profile_wrap">
                <div class="profile_title">基本信息</div>
                <div class="dashed_line"></div>
                <div class="clear"></div>
                <div class="basic_form J_focus pos_rel">
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>企业名称：</div>
                        <div class="item_val">

                            <div class="line_substring" title="">{{$company->name}}</div>
                            <span class="sm_tip">修改企业名称请联系客服人员，服务热线：<span class="num">0432-56864214</span></span>
                            <input type="hidden" name="name" value="{{$company->name}}">

                            {{--<input type="text" class="input_205_34" name="companyname">--}}

                        </div>
                        <div class="clear"></div>
                    </div>

                    <div class="item">
                        <div class="item_label">企业简称：</div>
                        <div class="item_val">
                            @if($company->short_name)
                                <div class="line_substring"
                                     title="{{$company->short_name}}">{{$company->short_name}}</div>
                            @else
                                <input type="text" value="" class="input_205_34 fl" name="short_name"
                                       placeholder="请填写大家最熟悉的名字"><span class="sm_tip">填写大家最熟悉的名字</span>
                            @endif
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>企业性质：</div>
                        <div class="item_val select_input select_205_34 J_hoverinput J_dropdown J_listitme_parent">
                            <span class="J_listitme_text">{{$company->nature_cn?$company->nature_cn:"请选择"}}</span>
                            <div class="dropdowbox8 J_dropdown_menu">
                                <div class="dropdow_inner8">
                                    <ul class="nav_box">
                                        @foreach($category['_company_type'] as $key=>$item)
                                            <li>
                                                <a class="J_listitme" href="javascript:;"
                                                   data-code="{{$key}}">{{$item}}</a>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                            <input class="J_listitme_code" name="nature" type="hidden"
                                   value="{{$company->nature}}"/>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>企业规模：</div>
                        <div class="item_val select_input select_205_34 J_hoverinput J_dropdown J_listitme_parent">
                            <span class="J_listitme_text">{{$company->scale_cn?$company->scale_cn:"请选择"}}</span>
                            <div class="dropdowbox8 J_dropdown_menu">
                                <div class="dropdow_inner8">
                                    <ul class="nav_box">
                                        @foreach($category['_scale'] as $key=>$item)
                                            <li>
                                                <a class="J_listitme" href="javascript:;"
                                                   data-code="{{$key}}">{{$item}}</a>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                            <input class="J_listitme_code" name="scale" type="hidden" value="{{$company->scale}}"/>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label">注册资金：</div>
                        <div class="item_val">
                            <div class="select_input_write">
                                <input type="text" class="inputst" dir="no_focus" name="registered"
                                       value="{{$company->registered}}"
                                       onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39) value=value.replace(/\D/g,'');"
                                       onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))">
                                <div class="righttxt for_tooltip J_tooltip J_listitme_parent">
                                    <span class="J_listitme_text">万</span>
                                    <div class="dropdowbox14 J_tooltip_menu">
                                        <div class="dropdow_inner14">
                                            <ul class="nav_box">
                                                <li><a class="J_listitme" href="javascript:;" data-code="万人民币">万人民币</a>
                                                </li>
                                                <li><a class="J_listitme" href="javascript:;" data-code="万美元">万美元</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <input class="J_listitme_code" name="currency" type="hidden" value="万人民币"/>
                                </div>
                                <div class="clear"></div>
                            </div>
                        </div>
                        <div class="item_label"><span class="asterisk"></span>所属行业：</div>
                        <div class="item_val select_input select_205_34 J_hoverinput" id="J_showmodal_trade"
                             data-title="请选择所属行业" data-multiple="false" data-maxnum="0" data-width="682">
                            <span title=""
                                  class="result J_resuletitle_trade">{{$company->trade_cn?$company->trade_cn:"请选择"}}</span>
                            <input class="J_resultcode_trade" type="hidden" name="trade" id="trade"
                                   value="{{$company->trade}}">
                            <div class="clear"></div>
                        </div>

                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>所在地区：</div>
                        <input type="text" id="district" name="district" class="input_205_34 fl" placeholder=""
                               value="{{$company->district_cn}}" readonly>
                        <input type="hidden" name="harea" data-id="0" id="harea" value="{{$company->area_cn}}">
                        <input type="hidden" name="hproper" data-id="0" id="hproper" value="{{$company->proper_cn}}">
                        <input type="hidden" name="hcity" data-id="0" id="hcity" value="{{$company->city_cn}}">

                        <input type="hidden" name="area" id="area" value="{{$company->area}}">
                        <input type="hidden" name="proper" id="proper" value="{{$company->proper}}">
                        <input type="hidden" name="city" id="city" value="{{$company->city}}">

                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>详细地址：</div>
                        <input type="text" value="{{$company->address}}" class="input_205_34 fl" style="width: 520px"
                               name="address"
                               placeholder="请输入详细地址">
                        <div class="clear"></div>
                    </div>

                    {{--<div class="logo_wrap pos_rel">--}}
                    {{--<div class="logo">--}}
                    {{--<img id="logo_res" width="120" height="120"--}}
                    {{--src="http://www.tywangcai.com/data/upload/resource/no_logo.png">--}}
                    {{--</div>--}}
                    {{--<div class="logo_upload" id="hidden_file" name="company_logo">--}}
                    {{--<div class="upimg">--}}
                    {{--<div class="up">上传logo</div>--}}
                    {{--<div class="uptip">要求：请用JPG,GIF 尺寸：120*120</div>--}}
                    {{--</div>--}}
                    {{--</div>--}}
                    {{--</div>--}}
                    <div class="clear_logo">清除</div>

                    <div class="item">


                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label">企业福利：</div>
                        <div class="item_val select_input_multi select_245_34 w518 J_hoverinput" style="width: 415px"
                             id="J_showmodal_jobtag"
                             data-title="请选择企业福利" data-multiple="true" data-maxnum="6" data-width="582">
                            <span title="" class="result J_resuletitle_jobtag">{{$tagValueArr}}</span>
                            <input class="J_resultcode_jobtag" type="hidden" name="tag" id="tag" value="{{$tagKeyArr}}">
                            <div class="clear"></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>企业介绍：</div>
                        <div class="item_val">
                            <textarea class="textarea_438_34 w518" rows="" cols=""
                                      name="contents">{{$company->contents}}</textarea>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>

            <div class="profile_wrap">
                <div class="profile_title contact">联系方式</div>
                <div class="dashed_line"></div>
                <div class="clear"></div>
                <div class="basic_form J_focus">
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>联系人：</div>
                        <div class="item_val">
                            <input type="text" value="{{$company->contact}}" class="input_245_34 fl" name="contact">
                            <label class="item_chk fl"><input type="checkbox" name="contact_show"
                                                              @if($company->contact_show == 0) checked @endif >
                                不公开</label>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="item">
                        <div class="item_label"><span class="asterisk"></span>联系电话：</div>
                        <div class="item_val">

                            {{--<div class="input_unit disabled fl">--}}
                            {{--<input type="text" value="18257193431" dir="no_focus" class="input_val input_205_34 nopd disabled" name="telephone">--}}
                            {{--<a href="javascript:;" id="J_auth_mobile" class="unit edit">[修改]</a>--}}
                            {{--<label class="item_chk fl"><input type="checkbox" name="telephone_show" value="1"> 不公开</label>--}}
                            {{--</div>--}}

                            <input type="text" value="{{$company->telephone}}" class="input_245_34 fl " disabled
                                   style="background-color:#EEEEEE" name="telephone">

                            <label class="item_chk fl"><input type="checkbox" name="telephone_show"
                                                              @if($company->telephone_show == 0) checked @endif >
                                不公开</label>
                        </div>
                        <div class="clear"></div>
                    </div>
                    {{--<div class="item">--}}
                    {{--<div class="item_label"><span class="asterisk"></span>联系邮箱：</div>--}}
                    {{--<div class="item_val">--}}
                    {{--<div class="reg-form-content fl">--}}
                    {{--<input type="text" value="" class="input_245_34 inputElem" name="email">--}}
                    {{--</div>--}}
                    {{--<label class="item_chk fl"><input type="checkbox" name="email_show"> 不公开</label>--}}
                    {{--</div>--}}
                    {{--<div class="clear"></div>--}}
                    {{--</div>--}}
                    <input type="hidden" id="id" name="id" value="{{isSet($company->id)?$company->id:0}}">

                    <div class="item">
                        <div class="item_label">&nbsp;</div>
                        <div class="item_val">
                            <div class="btn_blue J_hoverbut btn_115_38" id="save_info">保存</div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>

        </div>
        <div class="clear"></div>
    </div>
    <script>
        let QS_trade = ["1,消防", "2,安监"];
        let QS_jobtag = ["145,环境好", "146,年终奖", "147,双休", "148,五险一金", "149,加班费", "150,朝九晚五", "151,交通方便", "152,加班补助", "153,包食宿", "154,管理规范", "155,有提成", "156,全勤奖", "157,有年假", "158,专车接送", "159,有补助", "160,晋升快", "161,车贴", "162,房贴", "164,技术培训", "165,旅游"]
    </script>
    <script type="text/javascript" src="{{asset('static/js/jquery.disappear.tooltip.js')}}"></script>
    <script type="text/javascript" src="{{asset('static/js/jquery.dropdown.js')}}"></script>
    <script type="text/javascript" src="{{asset('static/js/area/Popt.js')}}"></script>
    <script type="text/javascript" src="{{asset('static/js/area/cityJson.js')}}?v=<?php echo time()?>"></script>
    <script type="text/javascript" src="{{asset('static/js/area/citySet.js')}}?v=<?php echo time()?>"></script>
    <script type="text/javascript" src="{{asset('static/js/jquery.listitem.js')}}"></script>
    <script type="text/javascript"
            src="{{asset('static/js/jquery.modal.userselectlayer.js')}}?v=<?php time()?>"></script>
    <script>
        $("#district").click(function (e) {
            SelCity(this, e);
        });
        // JavaScript Document
        $(document).ready(function () {
            //给所有J_hoverbut的元素增加hover样式
            $(".J_hoverbut").hover(
                function () {
                    $(this).addClass("hover");
                },
                function () {
                    $(this).removeClass("hover");
                }
            );

            //给符合条件的的文本框增加获取焦点的边框和背景变化
            $(".J_focus input[type='text'][dir!='no_focus'],.J_focus textarea[dir!='no_focus']").focus(function () {
                $(this).addClass("input_focus")
            });
            $(".J_focus input[type='text'][dir!='no_focus'],.J_focus textarea[dir!='no_focus']").blur(function () {
                $(this).removeClass("input_focus")
            });

            //给符合条件的的DIV文本框增加获取焦点的边框和背景变化
            $(".J_hoverinput").hover(
                function () {
                    $(this).addClass("input_focus");
                },
                function () {
                    $(this).removeClass("input_focus");
                }
            );
            /* 保存企业基本资料 */
            let regularMobile = qscms.regularMobile; // 验证手机号
            let regularEmail = /^[_\.0-9a-zA-Z-]+[_0-9a-zA-Z-]@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,3}$/; // 验证邮箱
            let regularTelFirst = /^[0-9]{3}[0-9]?$/; // 验证区号
            let regularTelNext = /^[0-9]{6,11}$/; // 验证电话号码
            let regularTelLast = /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/; // 验证分机号码
            let regularWebsite = /^http(s?):\/\/(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(:\d+)?(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/; // 验证企业网址
            let regularQQ = /^[1-9][0-9]{4,}$/; // 验证QQ
            $("#save_info").die().live('click', function () {
                let name = $.trim($("input[name=name]").val());
                let short_name = $.trim($("input[name=short_name]").val());
                let nature = $.trim($("input[name=nature]").val());
                let trade = $.trim($("input[name=trade]").val());
                let scale = $.trim($("input[name=scale]").val());

                let area_cn = $.trim($("input[name=harea]").val());
                let proper_cn = $.trim($("input[name=hproper]").val());
                let city_cn = $.trim($("input[name=hcity]").val());

                let area = $.trim($("input[name=area]").val());
                let proper = $.trim($("input[name=proper]").val());
                let city = $.trim($("input[name=city]").val());
                let district = $.trim($("input[name=district]").val());
                let registered = $.trim($("input[name=registered]").val());
                let currency = $.trim($("input[name=currency]").val());
                let address = $.trim($("input[name=address]").val());
                let tag = $.trim($("input[name=tag]").val());
                let short_desc = $.trim($("input[name=short_desc]").val());
                let contents = $.trim($("textarea[name=contents]").val());

                let contact = $.trim($("input[name=contact]").val());
                let telephone = $.trim($("input[name=telephone]").val());

                let contact_show = $("input[name=contact_show]").is(":checked") ? 0 : 1;
                let telephone_show = $("input[name=telephone_show]").is(":checked") ? 0 : 1;

                let id = $('#id').val();

                if (name == "") {
                    disapperTooltip("remind", "请填写企业名称");
                    return false;
                }
                if (nature == "0") {
                    disapperTooltip("remind", "请选择企业性质");
                    return false;
                }
                if (trade == "0") {
                    disapperTooltip("remind", "请选择所属行业");
                    return false;
                }
                if (scale == "0") {
                    disapperTooltip("remind", "请选择企业规模");
                    return false;
                }
                if (area == "0") {
                    disapperTooltip("remind", "请选择所在地区");
                    return false;
                }
                if (district == "0") {
                    disapperTooltip("remind", "请选择所在地区");
                    return false;
                }
                if (registered != "" && !regularTelLast.test(registered)) {
                    disapperTooltip("remind", "注册资金应为数字");
                    return false;
                }
                if (registered != "" && !regularTelLast.test(registered) || registered.length > 5) {
                    disapperTooltip("remind", "注册资金不能超出5位数");
                    return false;
                }

                if (contents == "") {
                    disapperTooltip("remind", "请填写企业介绍");
                    return false;
                }
                if (contact == "") {
                    disapperTooltip("remind", "请填写联系人");
                    return false;
                }
                if (contact != "" && contact.length > 10) {
                    disapperTooltip("remind", "联系人1-10个字");
                    return false;
                }
                if (telephone != "" && !regularMobile.test(telephone)) {
                    disapperTooltip("remind", "手机号格式不正确");
                    return false;
                }
                $(this).html('正在保存...');
                $(this).addClass('btn_gray9');
                $(this).removeClass('btn_blue');
                $.post("{{url('info/edit')}}", {
                    id: id,
                    name: name,
                    short_name: short_name,
                    nature: nature,
                    trade: trade,
                    scale: scale,
                    registered: registered,
                    currency: currency,
                    area: area,
                    proper: proper,
                    city: city,
                    area_cn: area_cn,
                    proper_cn: proper_cn,
                    city_cn: city_cn,
                    address: address,
                    district: district,
                    tag: tag,
                    short_desc: short_desc,
                    contents: contents,
                    contact: contact,
                    contact_show: contact_show,
                    telephone: telephone,
                    telephone_show: telephone_show,
                }, function (r) {
                    disapperTooltip('success', r.msg);
                    $("#save_info").html('保存');
                    $("#save_info").addClass('btn_blue');
                    $("#save_info").removeClass('btn_gray9');
                }, 'json');
            });
        });

    </script>
</div>
</body>
</html>
